package models

import "gorm.io/gorm"

type Question struct {
	gorm.Model
	QuestionType string   `json:"question_type" gorm:"type:varchar(255);not null"`
	Text         string   `json:"text" gorm:"type:varchar(255);not null"`
	Answers      []Answer `gorm:"foreignKey:QuestionID"`
}

func (q *Question) TableName() string {
	return "tbl_questions"
}

func NewQuestion(text string, answers []Answer, questionType string) *Question {
	return &Question{Text: text, Answers: answers, QuestionType: questionType}
}
